import { IPSDataEntity } from '../ipsdata-entity';
import { IPSDEAction } from './ipsdeaction';
import { IPSDEActionGroupDetail } from './ipsdeaction-group-detail';
import { IPSDEDataSet } from '../ds/ipsdedata-set';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEActionGroupDetailImpl extends PSModelObjectImpl implements IPSDEActionGroupDetail {
  get codeName(): string {
    return this.M.codeName;
  }

  get codeName2(): string {
    return this.M.codeName2;
  }

  get detailType(): 'DEACTION' | 'DEDATASET' {
    return this.M.detailType;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  get orderValue(): number {
    return this.M.orderValue;
  }

  protected psdeaction: IPSDEAction | null = null;

  getPSDEAction(): IPSDEAction | null {
    if (this.psdeaction != null) return this.psdeaction;
    const value = this.M.getPSDEAction;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getParentPSModelObject('dataentity.IPSDataEntity') as IPSDataEntity;
    if (ipsdataentity != null) {
      this.psdeaction = ipsdataentity.findPSDEAction(value);
    }
    return this.psdeaction;
  }

  get psDEAction(): IPSDEAction | null {
    return this.getPSDEAction();
  }

  getPSDEActionMust(): IPSDEAction {
    const value = this.getPSDEAction();
    if (value == null) {
      throw new Error('未指定实体行为');
    }
    return value;
  }

  protected psdedataset: IPSDEDataSet | null = null;

  getPSDEDataSet(): IPSDEDataSet | null {
    if (this.psdedataset != null) return this.psdedataset;
    const value = this.M.getPSDEDataSet;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getParentPSModelObject('dataentity.IPSDataEntity') as IPSDataEntity;
    if (ipsdataentity != null) {
      this.psdedataset = ipsdataentity.findPSDEDataSet(value);
    }
    return this.psdedataset;
  }

  get psDEDataSet(): IPSDEDataSet | null {
    return this.getPSDEDataSet();
  }

  getPSDEDataSetMust(): IPSDEDataSet {
    const value = this.getPSDEDataSet();
    if (value == null) {
      throw new Error('未指定实体数据集');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSDEActionGroupDetailImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.action.IPSDEActionGroupDetail') return true;
    return super.instanceof(cls);
  }
}
